<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100%;
        height: 100px;
        border-bottom: solid 2px red;
        padding-top: 0;
        display: flex;
        position: relative;
      }
      li {
        list-style-type: none;
      }

      ul {
        display: flex;
        justify-content: start;
        padding: 0;
        margin: 0;
        position: absolute;
        bottom: 0;
      }
      .box1 {
        width: 200px;
        height: 80px;
        color: black;
        text-align: center;
        line-height: 80px;
        font-size: 35px;
      }
      .active {
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div id="app" class="box">
      <ul>
        <li
          v-for="(item,index) in list"
          key="item.id"
          @click="activeIndex=index"
        >
          <div class="box1" :class="{active:activeIndex===index}">
            {{item.name}}
          </div>
        </li>
      </ul>
    </div>
    <script src="../vue.js"></script>
    <script>
      const app = new Vue({
        el: "#app",
        data: {
          activeIndex: 2,
          list: [
            { id: 1, name: "远强商店" },
            { id: 2, name: "远强书店" },
            { id: 3, name: "远强奶茶店" },
          ],
        },
      });
    </script>
  </body>
</html>
